﻿<%@ Page Language="C#" MasterPageFile="~/WebShop.master" AutoEventWireup="true" CodeFile="MyAccount.aspx.cs"
    Inherits="Member_MyOrder_MyAccount" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
 <link href="../../Pub/Css/JQ/pass_strenght.css" rel="stylesheet" type="text/css" />

    <script src="../../Pub/Js/JQ/jquery.pstrength-min.1.2.js"></script>

    <script>
			$(document).ready( function() {

				//BASIC				
				$("#<%=txtPassword.ClientID %>").pstrength();
			
			});
    </script>
    <table border="0" cellpadding="0" cellspacing="0" width="100%" class="tbl_News">
        <tr>
            <td class="td_TitileNews_590">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="td_Content_590">
                <table width="100%" style="padding-left: 15px; padding-right: 20px" cellpadding="0"
                    cellspacing="0">
                    <tr>
                        <td align="center">
                            <table border="0" class="tbl_Register" cellpadding="0" cellspacing="0" style="background-color: White;
                                color: #000000; width: 100%">
                                <tr>
                                    <td align="right" style="height: 223px" valign="middle">
                                        <table cellpadding="1" cellspacing="0" class="tbl_Info" width="100%">
                                            <tr>
                                                <td align="left" class="td_SubRegisterTitle" colspan="2" style="font-family: tahoma">
                                                    <asp:Label ID="lblTextTiltle" runat="server" Text="Thông tin khách hàng" Font-Size="13px"
                                                        Font-Bold="True"></asp:Label>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" style="width: 175px">
                                                </td>
                                                <td align="left" style="width: 400px">
                                                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="GrRegister"
                                                        CssClass="valid_common" ShowMessageBox="True" ShowSummary="False" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" nowrap style="width: 175px">
                                                    &nbsp;<asp:Label ID="Label4" runat="server" Text="Tên:" CssClass="lbl_Common"></asp:Label></td>
                                                <td align="left">
                                                    <asp:TextBox ID="txtName" runat="server" ValidationGroup="GrRegister" Width="80%"
                                                        CssClass="txt_Common"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtName"
                                                        ErrorMessage="Nhập vào tên khách hàng" ValidationGroup="GrRegister" CssClass="valid_common">*</asp:RequiredFieldValidator></td>
                                            </tr>
                                            <tr>
                                                <td align="right" style="width: 175px">
                                                    &nbsp; &nbsp;<asp:Label ID="Label8" runat="server" Text="Điện thoại:" CssClass="lbl_Common"></asp:Label></td>
                                                <td align="left">
                                                    <asp:TextBox ID="txtPhone" runat="server" ValidationGroup="GrRegister" CssClass="txt_Common"
                                                        Width="50%"></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtPhone"
                                                        ErrorMessage="Số điện thoại phải là số" ValidationExpression="^\d+$" ValidationGroup="GrRegister"
                                                        CssClass="valid_common">*</asp:RegularExpressionValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" style="width: 175px">
                                                    &nbsp;<asp:Label ID="Label7" runat="server" Text="Địa chỉ:" CssClass="lbl_Common"></asp:Label></td>
                                                <td align="left" style="width: 400px; color: #ff6600">
                                                    <span style="font-family: Arial"></span>
                                                    <asp:TextBox ID="txtAddress" runat="server" ValidationGroup="GrRegister" CssClass="txt_Common"
                                                        Width="80%"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtAddress"
                                                        ErrorMessage="Nhập vào địa chỉ" ValidationGroup="GrRegister" CssClass="valid_common">*</asp:RequiredFieldValidator></td>
                                            </tr>
                                            <tr>
                                                <td align="right" nowrap style="width: 175px">
                                                    <asp:Label ID="Label10" runat="server" Text="Tỉnh/Thành phố:" CssClass="lbl_Common"></asp:Label></td>
                                                <td align="left">
                                                    <asp:DropDownList ID="ddlPlace" runat="server">
                                                    </asp:DropDownList>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" style="width: 175px">
                                                    <asp:Label ID="Label14" runat="server" CssClass="lbl_Common" Text="Mã số thuế:"></asp:Label></td>
                                                <td align="left">
                                                    <asp:TextBox ID="txtTaxNo" runat="server" CssClass="txt_Common" Width="50%"></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" style="width: 175px">
                                                    &nbsp;<asp:Label ID="Label9" runat="server" Text="Email:" CssClass="lbl_Common"></asp:Label></td>
                                                <td align="left" nowrap>
                                                    <asp:TextBox ID="txtEmail" runat="server" onblur="fnCheckEmail(this.value)" onkeyup="fnHideImgEmail()"
                                                        ValidationGroup="GrRegister" CssClass="txt_Common" Width="80%"></asp:TextBox>&nbsp;
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtEmail"
                                                        ErrorMessage="Nhập chính xác địa chỉ Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                                        ValidationGroup="GrRegister" CssClass="valid_common">*</asp:RegularExpressionValidator>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator51" runat="server" ControlToValidate="hidEmail"
                                                        ErrorMessage="Email này đã được sử dụng" InitialValue="0" ValidationGroup="GrRegister"
                                                        CssClass="valid_common"> &nbsp;</asp:RequiredFieldValidator>&nbsp;
                                                    <img src="../../Images/Icon/spinner.gif" border="0" id="imgStateEmail" style="visibility: hidden" />
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator52" runat="server" ControlToValidate="hidEmail"
                                                        ErrorMessage="Đang xử lý..." ValidationGroup="GrRegister" CssClass="valid_common">Đang xử lý...</asp:RequiredFieldValidator>
                                                    <asp:TextBox ID="hidEmail" runat="server" CssClass="cssHidden" Text="1" Width="5px"></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" style="width: 175px">
                                                    <asp:Label ID="Label5" runat="server" Text="Ngày sinh:" CssClass="lbl_Common"></asp:Label></td>
                                                <td align="left">
                                                    <asp:DropDownList ID="drlDay" runat="server" CssClass="ddl_Info">
                                                    </asp:DropDownList>
                                                    <asp:DropDownList ID="drlMonth" runat="server" CssClass="ddl_Info">
                                                    </asp:DropDownList>&nbsp;<asp:DropDownList ID="drlYear" runat="server" CssClass="ddl_Info">
                                                    </asp:DropDownList><span style="font-family: Arial"> </span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" style="width: 175px">
                                                    &nbsp;<asp:Label ID="Label6" runat="server" Text="Giới tính:" CssClass="lbl_Common"></asp:Label></td>
                                                <td align="left" style="width: 400px">
                                                    <asp:DropDownList ID="DrlSex" runat="server" CssClass="ddl_Info">
                                                        <asp:ListItem Selected="True" Value="0">Nam</asp:ListItem>
                                                        <asp:ListItem Value="1">Nữ</asp:ListItem>
                                                    </asp:DropDownList></td>
                                            </tr>                                            
                                            <tr>
                                                <td align="right"  nowrap="nowrap">
                                                    <asp:CheckBox ID="chkAutoPass" onclick="IsAutoPassWord()" runat="server" Text="Thay đổi mật khẩu" /></td>
                                                    <td></td>
                                            </tr>
                                            <tr id="trPass1" runat="server">
                                                <td align="right" nowrap style="width: 175px">
                                                    <asp:Label ID="Label12" runat="server" Text="Mật khẩu mới:" CssClass="lbl_Common"></asp:Label></td>
                                                <td align="left">
                                                    <asp:TextBox ID="txtPassword" runat="server" TextMode="Password" ValidationGroup="GrRegister"
                                                        CssClass="txt_Common" Width="150px" CausesValidation="True" Text=""></asp:TextBox><asp:RequiredFieldValidator
                                                            ID="RequiredFieldValidator8" runat="server" ControlToValidate="txtPassword" ErrorMessage="Nhập vào mật khẩu"
                                                            ValidationGroup="GrRegister" CssClass="valid_common">*</asp:RequiredFieldValidator></td>
                                            </tr>
                                            <tr id="trPass2" runat="server">
                                                <td align="right" nowrap style="width: 175px">
                                                    <asp:Label ID="Label13" runat="server" Text="Gõ lại mật khẩu:" CssClass="lbl_Common"></asp:Label></td>
                                                <td align="left">
                                                    <asp:TextBox ID="txtTestPassword" runat="server" TextMode="Password" ValidationGroup="GrRegister"
                                                        CssClass="txt_Common" Width="150px" CausesValidation="True"></asp:TextBox><asp:CompareValidator ID="CompareValidator1"
                                                            runat="server" ControlToCompare="txtPassword" ControlToValidate="txtTestPassword"
                                                            ErrorMessage="Mật khẩu chưa trùng khớp" ValidationGroup="GrRegister" CssClass="valid_common">*</asp:CompareValidator>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="txtTestPassword"
                                                        CssClass="valid_common" ErrorMessage="Gõ lại mật khẩu mới" ValidationGroup="GrRegister">*</asp:RequiredFieldValidator></td>
                                            </tr>
                                            
                                            <tr>
                                                <td align="right" style="width: 175px">
                                                </td>
                                                <td align="left">
                                                    <asp:Button ID="btnSend" runat="server" Text="Bảo lưu" ValidationGroup="GrRegister"
                                                        CssClass="btn_Common" OnClick="btnSend_Click" />
                                                        <br />  <br />
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>

    <script language="javascript" type="text/javascript">
    // Removes leading whitespaces
     String.prototype.trim = function () {
		return this.replace(/^\s*/, "").replace(/\s*$/, "");
	}

    /*=================User================*/
    function fnHideImg()
    {
        var imgState=document.getElementById("imgState");
        imgState.style.visibility="hidden"; 
    }  
    
    
/*=================Email================*/
    function fnHideImgEmail()
    {
        var imgStateEmail=document.getElementById("imgStateEmail");
        imgStateEmail.style.visibility="hidden"; 
    }
    function fnCheckEmail(sValue)
    {      
         if(sValue.trim()=="")
        {   
            var hidEmail=document.getElementById("<%= hidEmail.ClientID%>");
            hidEmail.value="aaa";
            return;
        }
        

        Member_MyOrder_MyAccount.AjaxCheckEmail(sValue,CallBackEmail);  

     
    }
    function CallBackEmail(res)
    {
        if(res!=null)
        {
            var flag=res.value;
            if(flag!=null && flag!="")
			{	
			    var imgStateEmail=document.getElementById("imgStateEmail");

			    var hidEmail=document.getElementById("<%= hidEmail.ClientID%>");
			    hidEmail.value="aaa"; //Tranh su kien dang su ly
		
			    if(flag=="yes")
			    {   imgStateEmail.style.visibility="visible";
			        imgStateEmail.src="../../Images/Icon/cmdDelete.gif";
			        imgStateEmail.alt="Email này đã tồn tại";			        
			        hidEmail.value="0";
			       
			    }		
			    else
			    {
			           imgStateEmail.style.visibility="hidden";
			    }	    
			}	
        }
    }
    
    try
    {
       document.getElementById("<%=RequiredFieldValidator6.ClientID %>").enabled=false;   
        window.onload=IsAutoPassWord();
    }
    catch(e){}
    function IsAutoPassWord()
    {      
        
        var chkAutoPass=document.getElementById("<%=chkAutoPass.ClientID %>");
        var  trPass1=document.getElementById("<%=trPass1.ClientID %>");
        var  trPass2=document.getElementById("<%=trPass2.ClientID%>");
        if(chkAutoPass.checked==true)
        {           
            document.getElementById("<%=RequiredFieldValidator8.ClientID %>").enabled=true;
            document.getElementById("<%=RequiredFieldValidator6.ClientID %>").enabled=true;
            trPass1.style.visibility="visible";   
            trPass2.style.visibility="visible"; 
            document.getElementById("<%=txtPassword.ClientID %>").value=""; 
           // trPass1.style.display="block";   
           // trPass2.style.display="block";   
        }
        else
        {
            trPass1.style.visibility="hidden";   
            trPass2.style.visibility="hidden";  
            //trPass1.style.display="none";   
           // trPass2.style.display="none";      
            document.getElementById("<%=RequiredFieldValidator8.ClientID %>").enabled=false;   
            document.getElementById("<%=RequiredFieldValidator6.ClientID %>").enabled=false;   
            document.getElementById("<%=txtPassword.ClientID %>").value="";
        }
    }
    
    </script>

</asp:Content>
